package com.example.smartpark.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.smartpark.model.Vehicle;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * 车辆数据访问接口
 */
@Mapper
public interface VehicleMapper extends BaseMapper<Vehicle> {
    
    /**
     * 取消所有默认车辆
     * 
     * @param userId 用户ID
     * @return 更新行数
     */
    @Update("UPDATE vehicle SET is_default = 0 WHERE user_id = #{userId} AND is_default = 1")
    int cancelAllDefaultVehicles(@Param("userId") Integer userId);
} 